





<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>tvm.contrib &mdash; tvm 0.8.dev1982 文档</title>
  

  
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/tlcpack_theme.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/tvm-logo-square.png"/>
  

  
  
  
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/translations.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <script type="text/javascript" src="../../../_static/js/tlcpack_theme.js"></script>
    <link rel="index" title="索引" href="../../../genindex.html" />
    <link rel="search" title="搜索" href="../../../search.html" />
    <link rel="next" title="tvm.contrib.graph_executor" href="graph_executor.html" />
    <link rel="prev" title="tvm.micro" href="micro.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    
<header class="header">
    <div class="innercontainer">
      <div class="headerInner d-flex justify-content-between align-items-center">
          <div class="headerLogo">
               <a href="https://tvm.apache.org/"><img src=https://tvm.apache.org/assets/images/logo.svg alt="logo"></a>
          </div>

          <div id="headMenu" class="headerNav">
            <button type="button" id="closeHeadMenu" class="navCloseBtn"><img src="../../../_static/img/close-icon.svg" alt="Close"></button>
             <ul class="nav">
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/community>Community</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/download>Download</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/vta>VTA</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/blog>Blog</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/docs>Docs</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmconf.org>Conference</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://github.com/apache/tvm/>Github</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmchinese.github.io/declaration_zh_CN.html>About-Translators</a>
                </li>
             </ul>
               <div class="responsivetlcdropdown">
                 <button type="button" class="btn-link">
                   ASF
                 </button>
                 <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                 </ul>
               </div>
          </div>
            <div class="responsiveMenuIcon">
              <button type="button" id="menuBtn" class="btn-menu"><img src="../../../_static/img/menu-icon.svg" alt="Menu Icon"></button>
            </div>

            <div class="tlcDropdown">
              <div class="dropdown">
                <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  ASF
                </button>
                <div class="dropdown-menu dropdown-menu-right">
                  <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                  </ul>
                </div>
              </div>
          </div>
       </div>
    </div>
 </header>
 
    <nav data-toggle="wy-nav-shift" class="wy-nav-side fixed">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../index.html">
          

          
            
            <img src="../../../_static/tvm-logo-small.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
                <div class="version">
                  0.8.dev1982
                </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">如何开始</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../install/index.html">安装 TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contribute/index.html">贡献者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">用户引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../tutorial/index.html">User Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../how_to/index.html">How To Guides</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">开发者引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/tutorial/index.html">Developer Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/how_to/how_to.html">开发者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">架构指南</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../arch/index.html">Design and Architecture</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">主题引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../topic/microtvm/index.html">microTVM：裸机使用TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../topic/vta/index.html">VTA: Versatile Tensor Accelerator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">参考指南</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../langref/index.html">语言参考</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Python API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="runtime.html">tvm.runtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="ndarray.html">tvm.runtime.ndarray</a></li>
<li class="toctree-l2"><a class="reference internal" href="error.html">tvm.error</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html">tvm.ir</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html#module-tvm.instrument">tvm.instrument</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html#module-tvm.transform">tvm.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="target.html">tvm.target</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html">tvm.tir</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#module-tvm.tir.transform">tvm.tir.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#tvm-tir-analysis">tvm.tir.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#module-tvm.tir.stmt_functor">tvm.tir.stmt_functor</a></li>
<li class="toctree-l2"><a class="reference internal" href="te.html">tvm.te</a></li>
<li class="toctree-l2"><a class="reference internal" href="te.html#module-tvm.te.hybrid">tvm.te.hybrid</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html">tvm.driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/index.html">tvm.relay</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/frontend.html">tvm.relay.frontend</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/nn.html">tvm.relay.nn</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/vision.html">tvm.relay.vision</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/image.html">tvm.relay.image</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/transform.html">tvm.relay.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/analysis.html">tvm.relay.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/backend.html">tvm.relay.backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/dataflow_pattern.html">tvm.relay.dataflow_pattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/testing.html">tvm.relay.testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="autotvm.html">tvm.autotvm</a></li>
<li class="toctree-l2"><a class="reference internal" href="auto_scheduler.html">tvm.auto_scheduler</a></li>
<li class="toctree-l2"><a class="reference internal" href="rpc.html">tvm.rpc</a></li>
<li class="toctree-l2"><a class="reference internal" href="micro.html">tvm.micro</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">tvm.contrib</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.cblas">tvm.contrib.cblas</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.clang">tvm.contrib.clang</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.cc">tvm.contrib.cc</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.cublas">tvm.contrib.cublas</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.dlpack">tvm.contrib.dlpack</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.emcc">tvm.contrib.emcc</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.miopen">tvm.contrib.miopen</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.mxnet">tvm.contrib.mxnet</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.ndk">tvm.contrib.ndk</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.nnpack">tvm.contrib.nnpack</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.nvcc">tvm.contrib.nvcc</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.pickle_memoize">tvm.contrib.pickle_memoize</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.random">tvm.contrib.random</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.rocblas">tvm.contrib.rocblas</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.rocm">tvm.contrib.rocm</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.sparse">tvm.contrib.sparse</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.spirv">tvm.contrib.spirv</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.tar">tvm.contrib.tar</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.utils">tvm.contrib.utils</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.contrib.xcode">tvm.contrib.xcode</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="graph_executor.html">tvm.contrib.graph_executor</a></li>
<li class="toctree-l2"><a class="reference internal" href="topi.html">tvm.topi</a></li>
<li class="toctree-l2"><a class="reference internal" href="vta/index.html">vta</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../links.html">Other APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../genindex.html">索引</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      
      <nav class="wy-nav-top" aria-label="top navigation" data-toggle="wy-nav-top">
        
            <div class="togglemenu">

            </div>
            <div class="nav-content">
              <!-- tvm -->
              Table of content
            </div>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        

          




















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> <span class="br-arrow">></span></li>
        
          <li><a href="index.html">Python API</a> <span class="br-arrow">></span></li>
        
      <li>tvm.contrib</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../../../_sources/reference/api/python/contrib.rst.txt" rel="nofollow"> <img src="../../../_static//img/source.svg" alt="viewsource"/></a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-tvm.contrib">
<span id="tvm-contrib"></span><h1>tvm.contrib<a class="headerlink" href="#module-tvm.contrib" title="永久链接至标题">¶</a></h1>
<p>Contrib APIs of TVM python package.</p>
<p>Contrib API provides many useful not core features.
Some of these are useful utilities to interact with
thirdparty libraries and tools.</p>
<div class="section" id="module-tvm.contrib.cblas">
<span id="tvm-contrib-cblas"></span><h2>tvm.contrib.cblas<a class="headerlink" href="#module-tvm.contrib.cblas" title="永久链接至标题">¶</a></h2>
<p>External function interface to BLAS libraries.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cblas.matmul">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cblas.</span></span><span class="sig-name descname"><span class="pre">matmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transa</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cblas.matmul" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute matrix mult of A and rhs with CrhsLAS
This function serves as an example on how to call external libraries.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The left matrix operand</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The right matrix operand</p></li>
<li><p><strong>transa</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose lhs</p></li>
<li><p><strong>transb</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose rhs</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – The result tensor.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cblas.batch_matmul">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cblas.</span></span><span class="sig-name descname"><span class="pre">batch_matmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transa</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterative</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cblas.batch_matmul" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute batched matrix mult of A and rhs with CBLAS
This function serves as an example on how to call external libraries.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The left matrix operand</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The right matrix operand</p></li>
<li><p><strong>transa</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose lhs</p></li>
<li><p><strong>transb</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose rhs</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – The result tensor.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.clang">
<span id="tvm-contrib-clang"></span><h2>tvm.contrib.clang<a class="headerlink" href="#module-tvm.contrib.clang" title="永久链接至标题">¶</a></h2>
<p>Util to invoke clang in the system.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.clang.find_clang">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.clang.</span></span><span class="sig-name descname"><span class="pre">find_clang</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">required</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.clang.find_clang" title="永久链接至目标">¶</a></dt>
<dd><p>Find clang in system.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>required</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether it is required,
runtime error will be raised if the compiler is required.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>valid_list</strong> – List of possible paths.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>list of str</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This function will first search clang that
matches the major llvm version that built with tvm</p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.clang.create_llvm">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.clang.</span></span><span class="sig-name descname"><span class="pre">create_llvm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.clang.create_llvm" title="永久链接至目标">¶</a></dt>
<dd><p>Create llvm text ir.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>list of str</em>) – List of input files name or code source.</p></li>
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – Output file, if it is none
a temporary file is created</p></li>
<li><p><strong>options</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – The list of additional options string.</p></li>
<li><p><strong>cc</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The clang compiler, if not specified,
we will try to guess the matched clang version.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>code</strong> – The generated llvm text IR.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.cc">
<span id="tvm-contrib-cc"></span><h2>tvm.contrib.cc<a class="headerlink" href="#module-tvm.contrib.cc" title="永久链接至标题">¶</a></h2>
<p>Util to invoke C/C++ compilers in the system.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cc.create_shared">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cc.</span></span><span class="sig-name descname"><span class="pre">create_shared</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objects</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'g++'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cc.create_shared" title="永久链接至目标">¶</a></dt>
<dd><p>Create shared library.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target shared library.</p></li>
<li><p><strong>objects</strong> (<a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – List of object files.</p></li>
<li><p><strong>options</strong> (<a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The list of additional options string.</p></li>
<li><p><strong>cc</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The compiler command.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cc.create_executable">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cc.</span></span><span class="sig-name descname"><span class="pre">create_executable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objects</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'g++'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cc.create_executable" title="永久链接至目标">¶</a></dt>
<dd><p>Create executable binary.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target executable.</p></li>
<li><p><strong>objects</strong> (<a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – List of object files.</p></li>
<li><p><strong>options</strong> (<a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The list of additional options string.</p></li>
<li><p><strong>cc</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The compiler command.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cc.get_target_by_dump_machine">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cc.</span></span><span class="sig-name descname"><span class="pre">get_target_by_dump_machine</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compiler</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cc.get_target_by_dump_machine" title="永久链接至目标">¶</a></dt>
<dd><p>Functor of get_target_triple that can get the target triple using compiler.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>compiler</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The compiler.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>out</strong> – A function that can get target triple according to dumpmachine option of compiler.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable">Callable</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cc.cross_compiler">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cc.</span></span><span class="sig-name descname"><span class="pre">cross_compiler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compile_func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output_format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">get_target_triple</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">add_files</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cc.cross_compiler" title="永久链接至目标">¶</a></dt>
<dd><p>Create a cross compiler function by specializing compile_func with options.</p>
<p>This function can be used to construct compile functions that
can be passed to AutoTVM measure or export_library.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>compile_func</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a><em>[</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em><em>]</em><em>, </em><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em>]</em><em>]</em>) – Function that performs the actual compilation</p></li>
<li><p><strong>options</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em><em>]</em>) – List of additional optional string.</p></li>
<li><p><strong>output_format</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – Library output format.</p></li>
<li><p><strong>get_target_triple</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a><em>]</em>) – Function that can target triple according to dumpmachine option of compiler.</p></li>
<li><p><strong>add_files</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em><em>]</em>) – List of paths to additional object, source, library files
to pass as part of the compilation.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>fcompile</strong> – A compilation function that can be passed to export_library.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable">Callable</a>[[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a>, Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a>]], <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)">None</a>]</p>
</dd>
</dl>
<p class="rubric">实际案例</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">tvm.contrib</span> <span class="kn">import</span> <span class="n">cc</span><span class="p">,</span> <span class="n">ndk</span>
<span class="c1"># export using arm gcc</span>
<span class="n">mod</span> <span class="o">=</span> <span class="n">build_runtime_module</span><span class="p">()</span>
<span class="n">mod</span><span class="o">.</span><span class="n">export_library</span><span class="p">(</span><span class="n">path_dso</span><span class="p">,</span>
                   <span class="n">cc</span><span class="o">.</span><span class="n">cross_compiler</span><span class="p">(</span><span class="s2">&quot;arm-linux-gnueabihf-gcc&quot;</span><span class="p">))</span>
<span class="c1"># specialize ndk compilation options.</span>
<span class="n">specialized_ndk</span> <span class="o">=</span> <span class="n">cc</span><span class="o">.</span><span class="n">cross_compiler</span><span class="p">(</span>
    <span class="n">ndk</span><span class="o">.</span><span class="n">create_shared</span><span class="p">,</span>
    <span class="p">[</span><span class="s2">&quot;--sysroot=/path/to/sysroot&quot;</span><span class="p">,</span> <span class="s2">&quot;-shared&quot;</span><span class="p">,</span> <span class="s2">&quot;-fPIC&quot;</span><span class="p">,</span> <span class="s2">&quot;-lm&quot;</span><span class="p">])</span>
<span class="n">mod</span><span class="o">.</span><span class="n">export_library</span><span class="p">(</span><span class="n">path_dso</span><span class="p">,</span> <span class="n">specialized_ndk</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.cublas">
<span id="tvm-contrib-cublas"></span><h2>tvm.contrib.cublas<a class="headerlink" href="#module-tvm.contrib.cublas" title="永久链接至标题">¶</a></h2>
<p>External function interface to cuBLAS libraries.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cublas.matmul">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cublas.</span></span><span class="sig-name descname"><span class="pre">matmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transa</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cublas.matmul" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute matrix mult of A and rhs with cuBLAS</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The left matrix operand</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The right matrix operand</p></li>
<li><p><strong>transa</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose lhs</p></li>
<li><p><strong>transb</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose rhs</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – The result tensor.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.cublas.batch_matmul">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.cublas.</span></span><span class="sig-name descname"><span class="pre">batch_matmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transa</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.cublas.batch_matmul" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute batch matrix mult of A and rhs with cuBLAS</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The left matrix operand</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The right matrix operand</p></li>
<li><p><strong>transa</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose lhs</p></li>
<li><p><strong>transb</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose rhs</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – The result tensor.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.dlpack">
<span id="tvm-contrib-dlpack"></span><h2>tvm.contrib.dlpack<a class="headerlink" href="#module-tvm.contrib.dlpack" title="永久链接至标题">¶</a></h2>
<p>Wrapping functions to bridge frameworks with DLPack support to TVM</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.dlpack.convert_func">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.dlpack.</span></span><span class="sig-name descname"><span class="pre">convert_func</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tvm_func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tensor_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">to_dlpack_func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.dlpack.convert_func" title="永久链接至目标">¶</a></dt>
<dd><dl class="simple">
<dt>Convert a tvm function into one that accepts a tensor from another</dt><dd><p>framework, provided the other framework supports DLPACK</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tvm_func</strong> (<em>Function</em>) – Built tvm function operating on arrays</p></li>
<li><p><strong>tensor_type</strong> (<a class="reference internal" href="ir.html#tvm.ir.Type" title="tvm.ir.Type"><em>Type</em></a>) – Type of the tensors of the target framework</p></li>
<li><p><strong>to_dlpack_func</strong> (<em>Function</em>) – Function to convert the source tensors to DLPACK</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.dlpack.to_pytorch_func">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.dlpack.</span></span><span class="sig-name descname"><span class="pre">to_pytorch_func</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tvm_func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.dlpack.to_pytorch_func" title="永久链接至目标">¶</a></dt>
<dd><p>Convert a tvm function into one that accepts PyTorch tensors</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>tvm_func</strong> (<em>Function</em>) – Built tvm function operating on arrays</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>wrapped_func</strong> – Wrapped tvm function that operates on PyTorch tensors</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>Function</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.emcc">
<span id="tvm-contrib-emcc"></span><h2>tvm.contrib.emcc<a class="headerlink" href="#module-tvm.contrib.emcc" title="永久链接至标题">¶</a></h2>
<p>Util to invoke emscripten compilers in the system.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.emcc.create_tvmjs_wasm">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.emcc.</span></span><span class="sig-name descname"><span class="pre">create_tvmjs_wasm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objects</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'emcc'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.emcc.create_tvmjs_wasm" title="永久链接至目标">¶</a></dt>
<dd><p>Create wasm that is supposed to run with the tvmjs.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target shared library.</p></li>
<li><p><strong>objects</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – List of object files.</p></li>
<li><p><strong>options</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The additional options.</p></li>
<li><p><strong>cc</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The compile string.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.miopen">
<span id="tvm-contrib-miopen"></span><h2>tvm.contrib.miopen<a class="headerlink" href="#module-tvm.contrib.miopen" title="永久链接至标题">¶</a></h2>
<p>External function interface to MIOpen library.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.miopen.conv2d_forward">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.miopen.</span></span><span class="sig-name descname"><span class="pre">conv2d_forward</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">w</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stride_h</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stride_w</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pad_h</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pad_w</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dilation_h</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dilation_w</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">conv_mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.miopen.conv2d_forward" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute 2D convolution with MIOpen</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – input feature map</p></li>
<li><p><strong>w</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – convolution weight</p></li>
<li><p><strong>stride_h</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – height stride</p></li>
<li><p><strong>stride_w</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – width stride</p></li>
<li><p><strong>pad_h</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – height pad</p></li>
<li><p><strong>pad_w</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – weight pad</p></li>
<li><p><strong>dilation_h</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – height dilation</p></li>
<li><p><strong>dilation_w</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – width dilation</p></li>
<li><p><strong>conv_mode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – 0: miopenConvolution
1: miopenTranspose</p></li>
<li><p><strong>data_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – 0: miopenHalf (fp16)
1: miopenFloat (fp32)</p></li>
<li><p><strong>group_count</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – number of groups</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>y</strong> – The result tensor</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.miopen.softmax">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.miopen.</span></span><span class="sig-name descname"><span class="pre">softmax</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axis</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.miopen.softmax" title="永久链接至目标">¶</a></dt>
<dd><p>Compute softmax with MIOpen</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>tvm.te.Tensor</em></a>) – The input tensor</p></li>
<li><p><strong>axis</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The axis to compute softmax over</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The result tensor</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">tvm.te.Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.miopen.log_softmax">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.miopen.</span></span><span class="sig-name descname"><span class="pre">log_softmax</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axis</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.miopen.log_softmax" title="永久链接至目标">¶</a></dt>
<dd><p>Compute log softmax with MIOpen</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>tvm.te.Tensor</em></a>) – The input tensor</p></li>
<li><p><strong>axis</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The axis to compute log softmax over</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The result tensor</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">tvm.te.Tensor</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.mxnet">
<span id="tvm-contrib-mxnet"></span><h2>tvm.contrib.mxnet<a class="headerlink" href="#module-tvm.contrib.mxnet" title="永久链接至标题">¶</a></h2>
<p>MXNet bridge wrap Function MXNet’s async function.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.mxnet.to_mxnet_func">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.mxnet.</span></span><span class="sig-name descname"><span class="pre">to_mxnet_func</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">const_loc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.mxnet.to_mxnet_func" title="永久链接至目标">¶</a></dt>
<dd><p>Wrap a TVM function as MXNet function</p>
<p>MXNet function runs asynchrously via its engine.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> (<em>Function</em>) – A TVM function that can take positional arguments</p></li>
<li><p><strong>const_loc</strong> (<em>list of int</em>) – List of integers indicating the argument position
of read only NDArray argument.
The NDArray argument location that are not annotated
will be viewed as mutable arrays in MXNet’s engine.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>async_func</strong> – A function that can take MXNet NDArray as argument
in places that used to expect TVM NDArray.
Run asynchrously in MXNet’s async engine.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>Function</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.ndk">
<span id="tvm-contrib-ndk"></span><h2>tvm.contrib.ndk<a class="headerlink" href="#module-tvm.contrib.ndk" title="永久链接至标题">¶</a></h2>
<p>Util to invoke NDK compiler toolchain.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.ndk.create_shared">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.ndk.</span></span><span class="sig-name descname"><span class="pre">create_shared</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objects</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.ndk.create_shared" title="永久链接至目标">¶</a></dt>
<dd><p>Create shared library.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target shared library.</p></li>
<li><p><strong>objects</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – List of object files.</p></li>
<li><p><strong>options</strong> (<em>list of str</em><em>, </em><em>optional</em>) – The additional options.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.nnpack">
<span id="tvm-contrib-nnpack"></span><h2>tvm.contrib.nnpack<a class="headerlink" href="#module-tvm.contrib.nnpack" title="永久链接至标题">¶</a></h2>
<p>External function interface to NNPACK libraries.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nnpack.is_available">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nnpack.</span></span><span class="sig-name descname"><span class="pre">is_available</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nnpack.is_available" title="永久链接至目标">¶</a></dt>
<dd><p>Check whether NNPACK is available, that is, <cite>nnp_initialize()</cite>
returns <cite>nnp_status_success</cite>.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nnpack.fully_connected_inference">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nnpack.</span></span><span class="sig-name descname"><span class="pre">fully_connected_inference</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nthreads</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nnpack.fully_connected_inference" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute fully connected of 1D tensor lhs and
2D tensor rhs with nnpack.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – lhs 1D array input[input_channels] of FP32 elements</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – lhs 2D matrix kernel[output_channels][input_channels] of FP32 elements</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – lhs 1D array out[output_channels] of FP32 elements.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nnpack.convolution_inference">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nnpack.</span></span><span class="sig-name descname"><span class="pre">convolution_inference</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kernel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bias</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">padding</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stride</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nthreads</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">algorithm</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nnpack.convolution_inference" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op to do inference convolution of 4D tensor data and
4D tensor kernel and 1D tensor bias with nnpack.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – data 4D tensor input[batch][input_channels][input_height][input_width] of
FP32 elements.</p></li>
<li><p><strong>kernel</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – kernel 4D tensor kernel[output_channels][input_channels][kernel_height]
[kernel_width] of FP32 elements.</p></li>
<li><p><strong>bias</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – bias 1D array bias[output_channels][input_channels][kernel_height]
[kernel_width] of FP32 elements.</p></li>
<li><p><strong>padding</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – padding A 4-dim list of [pad_top, pad_bottom, pad_left, pad_right],
which indicates the padding around the feature map.</p></li>
<li><p><strong>stride</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – stride A 2-dim list of [stride_height, stride_width], which indicates
the stride.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>output</strong> – output 4D tensor output[batch][output_channels][output_height][output_width]
of FP32 elements.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nnpack.convolution_inference_without_weight_transform">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nnpack.</span></span><span class="sig-name descname"><span class="pre">convolution_inference_without_weight_transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transformed_kernel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bias</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">padding</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stride</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nthreads</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">algorithm</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nnpack.convolution_inference_without_weight_transform" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op to do inference convolution of 4D tensor data and
4D pre-transformed tensor kernel and 1D tensor bias with nnpack.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – data 4D tensor input[batch][input_channels][input_height][input_width] of
FP32 elements.</p></li>
<li><p><strong>transformed_kernel</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – transformed_kernel 4D tensor kernel[output_channels][input_channels][tile]
[tile] of FP32 elements.</p></li>
<li><p><strong>bias</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – bias 1D array bias[output_channels][input_channels][kernel_height]
[kernel_width] of FP32 elements.</p></li>
<li><p><strong>padding</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – padding A 4-dim list of [pad_top, pad_bottom, pad_left, pad_right],
which indicates the padding around the feature map.</p></li>
<li><p><strong>stride</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – stride A 2-dim list of [stride_height, stride_width], which indicates
the stride.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>output</strong> – output 4D tensor output[batch][output_channels][output_height][output_width]
of FP32 elements.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nnpack.convolution_inference_weight_transform">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nnpack.</span></span><span class="sig-name descname"><span class="pre">convolution_inference_weight_transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">kernel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nthreads</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">algorithm</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'float32'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nnpack.convolution_inference_weight_transform" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op to do inference convolution of 3D tensor data and
4D tensor kernel and 1D tensor bias with nnpack.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>kernel</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – kernel 4D tensor kernel[output_channels][input_channels][kernel_height]
[kernel_width] of FP32 elements.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>output</strong> – output 4D tensor output[output_channels][input_channels][tile][tile]
of FP32 elements.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.nvcc">
<span id="tvm-contrib-nvcc"></span><h2>tvm.contrib.nvcc<a class="headerlink" href="#module-tvm.contrib.nvcc" title="永久链接至标题">¶</a></h2>
<p>Utility to invoke nvcc compiler in the system</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.compile_cuda">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">compile_cuda</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'ptx'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">arch</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path_target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.compile_cuda" title="永久链接至目标">¶</a></dt>
<dd><p>Compile cuda code with NVCC from env.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>code</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The cuda code.</p></li>
<li><p><strong>target</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target format</p></li>
<li><p><strong>arch</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The architecture</p></li>
<li><p><strong>options</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>list of str</em>) – The additional options</p></li>
<li><p><strong>path_target</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – Output file.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>cubin</strong> – The bytearray of the cubin</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytearray" title="(在 Python v3.10)">bytearray</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.find_cuda_path">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">find_cuda_path</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.find_cuda_path" title="永久链接至目标">¶</a></dt>
<dd><p>Utility function to find cuda path</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>path</strong> – Path to cuda root.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.get_cuda_version">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">get_cuda_version</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cuda_path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.get_cuda_version" title="永久链接至目标">¶</a></dt>
<dd><p>Utility function to get cuda version</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>cuda_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Path to cuda root.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>version</strong> – The cuda version</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)">float</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.get_target_compute_version">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">get_target_compute_version</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.get_target_compute_version" title="永久链接至目标">¶</a></dt>
<dd><p>Utility function to get compute capability of compilation target.</p>
<p>Looks for the arch in three different places, first in the target attributes, then the global
scope, and finally the GPU device (if it exists).</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>tvm.target.Target</em></a><em>, </em><em>optional</em>) – The compilation target</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>compute_version</strong> – compute capability of a GPU (e.g. “8.0”)</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.parse_compute_version">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">parse_compute_version</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compute_version</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.parse_compute_version" title="永久链接至目标">¶</a></dt>
<dd><p>Parse compute capability string to divide major and minor version</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>compute_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – compute capability of a GPU (e.g. “6.0”)</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>major</strong> (<em>int</em>) – major version number</p></li>
<li><p><strong>minor</strong> (<em>int</em>) – minor version number</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.have_fp16">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">have_fp16</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compute_version</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.have_fp16" title="永久链接至目标">¶</a></dt>
<dd><p>Either fp16 support is provided in the compute capability or not</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>compute_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – compute capability of a GPU (e.g. “6.0”)</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.have_int8">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">have_int8</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compute_version</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.have_int8" title="永久链接至目标">¶</a></dt>
<dd><p>Either int8 support is provided in the compute capability or not</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>compute_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – compute capability of a GPU (e.g. “6.1”)</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.have_tensorcore">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">have_tensorcore</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compute_version</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.have_tensorcore" title="永久链接至目标">¶</a></dt>
<dd><p>Either TensorCore support is provided in the compute capability or not</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>compute_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – compute capability of a GPU (e.g. “7.0”).</p></li>
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>tvm.target.Target</em></a><em>, </em><em>optional</em>) – The compilation target, will be used to determine arch if compute_version
isn’t specified.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.have_cudagraph">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">have_cudagraph</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.have_cudagraph" title="永久链接至目标">¶</a></dt>
<dd><p>Either CUDA Graph support is provided</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.nvcc.have_bf16">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.nvcc.</span></span><span class="sig-name descname"><span class="pre">have_bf16</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compute_version</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.nvcc.have_bf16" title="永久链接至目标">¶</a></dt>
<dd><p>Either bf16 support is provided in the compute capability or not</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>compute_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – compute capability of a GPU (e.g. “8.0”)</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.pickle_memoize">
<span id="tvm-contrib-pickle-memoize"></span><h2>tvm.contrib.pickle_memoize<a class="headerlink" href="#module-tvm.contrib.pickle_memoize" title="永久链接至标题">¶</a></h2>
<p>Memoize result of function via pickle, used for cache testcases.</p>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.contrib.pickle_memoize.Cache">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.pickle_memoize.</span></span><span class="sig-name descname"><span class="pre">Cache</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">save_at_exit</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.pickle_memoize.Cache" title="永久链接至目标">¶</a></dt>
<dd><p>A cache object for result cache.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The file key to the function</p></li>
<li><p><strong>save_at_exit</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether save the cache to file when the program exits</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.pickle_memoize.memoize">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.pickle_memoize.</span></span><span class="sig-name descname"><span class="pre">memoize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">save_at_exit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.pickle_memoize.memoize" title="永久链接至目标">¶</a></dt>
<dd><p>Memoize the result of function and reuse multiple times.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The unique key to the file</p></li>
<li><p><strong>save_at_exit</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether save the cache to file when the program exits</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>fmemoize</strong> – The decorator function to perform memoization.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>function</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.random">
<span id="tvm-contrib-random"></span><h2>tvm.contrib.random<a class="headerlink" href="#module-tvm.contrib.random" title="永久链接至标题">¶</a></h2>
<p>External function interface to random library.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.random.randint">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.random.</span></span><span class="sig-name descname"><span class="pre">randint</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">low</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">high</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'int32'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.random.randint" title="永久链接至目标">¶</a></dt>
<dd><p>Return random integers from low (inclusive) to high (exclusive).
Return random integers from the “discrete uniform” distribution of the
specified dtype in the “half-open” interval [low, high).</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>low</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Lowest (signed) integer to be drawn from the distribution</p></li>
<li><p><strong>high</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – One above the largest (signed) integer to be drawn from the distribution</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>out</strong> – A tensor with specified size and dtype</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.random.uniform">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.random.</span></span><span class="sig-name descname"><span class="pre">uniform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">low</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">high</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.random.uniform" title="永久链接至目标">¶</a></dt>
<dd><p>Draw samples from a uniform distribution.</p>
<p>Samples are uniformly distributed over the half-open interval [low, high)
(includes low, but excludes high). In other words, any value within the
given interval is equally likely to be drawn by uniform.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>low</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – Lower boundary of the output interval. All values generated will be
greater than or equal to low.</p></li>
<li><p><strong>high</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – Upper boundary of the output interval. All values generated will be
less than high.</p></li>
<li><p><strong>size</strong> (<em>tuple of ints</em>) – Output shape. If the given shape is, e.g., (m, n, k), then m * n * k
samples are drawn.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>out</strong> – A tensor with specified size and dtype.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.random.normal">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.random.</span></span><span class="sig-name descname"><span class="pre">normal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loc</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scale</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.random.normal" title="永久链接至目标">¶</a></dt>
<dd><p>Draw samples from a normal distribution.</p>
<p>Return random samples from a normal distribution.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>loc</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – loc of the distribution.</p></li>
<li><p><strong>scale</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – Standard deviation of the distribution.</p></li>
<li><p><strong>size</strong> (<em>tuple of ints</em>) – Output shape. If the given shape is, e.g., (m, n, k), then m * n * k
samples are drawn.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>out</strong> – A tensor with specified size and dtype</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.rocblas">
<span id="tvm-contrib-rocblas"></span><h2>tvm.contrib.rocblas<a class="headerlink" href="#module-tvm.contrib.rocblas" title="永久链接至标题">¶</a></h2>
<p>External function interface to rocBLAS libraries.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.rocblas.matmul">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.rocblas.</span></span><span class="sig-name descname"><span class="pre">matmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transa</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.rocblas.matmul" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute matrix mult of A and rhs with rocBLAS</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The left matrix operand</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The right matrix operand</p></li>
<li><p><strong>transa</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose lhs</p></li>
<li><p><strong>transb</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose rhs</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – The result tensor.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.rocblas.batch_matmul">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.rocblas.</span></span><span class="sig-name descname"><span class="pre">batch_matmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rhs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transa</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transb</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.rocblas.batch_matmul" title="永久链接至目标">¶</a></dt>
<dd><p>Create an extern op that compute matrix mult of A and rhs with rocBLAS</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The left batched matrix operand</p></li>
<li><p><strong>rhs</strong> (<a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – The right batched matrix operand</p></li>
<li><p><strong>transa</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose lhs</p></li>
<li><p><strong>transb</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether transpose rhs</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>C</strong> – The result tensor.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor">Tensor</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.rocm">
<span id="tvm-contrib-rocm"></span><h2>tvm.contrib.rocm<a class="headerlink" href="#module-tvm.contrib.rocm" title="永久链接至标题">¶</a></h2>
<p>Utility for ROCm backend</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.rocm.find_lld">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.rocm.</span></span><span class="sig-name descname"><span class="pre">find_lld</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">required</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.rocm.find_lld" title="永久链接至目标">¶</a></dt>
<dd><p>Find ld.lld in system.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>required</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether it is required,
runtime error will be raised if the compiler is required.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>valid_list</strong> – List of possible paths.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>list of str</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This function will first search ld.lld that
matches the major llvm version that built with tvm</p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.rocm.rocm_link">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.rocm.</span></span><span class="sig-name descname"><span class="pre">rocm_link</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">in_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lld</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.rocm.rocm_link" title="永久链接至目标">¶</a></dt>
<dd><p>Link relocatable ELF object to shared ELF object using lld</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>in_file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Input file name (relocatable ELF object file)</p></li>
<li><p><strong>out_file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Output file name (shared ELF object file)</p></li>
<li><p><strong>lld</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The lld linker, if not specified,
we will try to guess the matched clang version.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.sparse">
<span id="tvm-contrib-sparse"></span><h2>tvm.contrib.sparse<a class="headerlink" href="#module-tvm.contrib.sparse" title="永久链接至标题">¶</a></h2>
<p>Tensor and Operation class for computation declaration.</p>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.contrib.sparse.CSRNDArray">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.sparse.</span></span><span class="sig-name descname"><span class="pre">CSRNDArray</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.CSRNDArray" title="永久链接至目标">¶</a></dt>
<dd><p>Sparse tensor object in CSR format.</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.sparse.CSRNDArray.asnumpy">
<span class="sig-name descname"><span class="pre">asnumpy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.CSRNDArray.asnumpy" title="永久链接至目标">¶</a></dt>
<dd><p>Construct a full matrix and convert it to numpy array. This API will be deprecated
in TVM v0.8 release. Please use <cite>numpy</cite> instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.sparse.CSRNDArray.numpy">
<span class="sig-name descname"><span class="pre">numpy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.CSRNDArray.numpy" title="永久链接至目标">¶</a></dt>
<dd><p>Construct a full matrix and convert it to numpy array.</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.sparse.array">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.sparse.</span></span><span class="sig-name descname"><span class="pre">array</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source_array</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'csr'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.array" title="永久链接至目标">¶</a></dt>
<dd><p>Construct a sparse NDArray from numpy.ndarray</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.contrib.sparse.SparsePlaceholderOp">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.sparse.</span></span><span class="sig-name descname"><span class="pre">SparsePlaceholderOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nonzeros</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.SparsePlaceholderOp" title="永久链接至目标">¶</a></dt>
<dd><p>Placeholder class for sparse tensor representations.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.contrib.sparse.CSRPlaceholderOp">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.sparse.</span></span><span class="sig-name descname"><span class="pre">CSRPlaceholderOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nonzeros</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.CSRPlaceholderOp" title="永久链接至目标">¶</a></dt>
<dd><p>Placeholder class for CSR based sparse tensor representation.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.sparse.placeholder">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.sparse.</span></span><span class="sig-name descname"><span class="pre">placeholder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nonzeros</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'placeholder'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.sparse.placeholder" title="永久链接至目标">¶</a></dt>
<dd><p>Construct an empty sparse tensor object.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>shape</strong> (<em>Tuple of Expr</em>) – The shape of the tensor</p></li>
<li><p><strong>nonzeros</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The number of non-zero values</p></li>
<li><p><strong>dtype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The data type of the tensor</p></li>
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The name hint of the tensor</p></li>
<li><p><strong>stype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The name storage type of the sparse tensor (e.g. csr, coo, ell)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>tensor</strong> – The created sparse tensor placeholder</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.contrib.sparse.SparsePlaceholderOp" title="tvm.contrib.sparse.SparsePlaceholderOp">SparsePlaceholderOp</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.spirv">
<span id="tvm-contrib-spirv"></span><h2>tvm.contrib.spirv<a class="headerlink" href="#module-tvm.contrib.spirv" title="永久链接至标题">¶</a></h2>
<p>Utility for Interacting with SPIRV Tools</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.spirv.optimize">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.spirv.</span></span><span class="sig-name descname"><span class="pre">optimize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">spv_bin</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.spirv.optimize" title="永久链接至目标">¶</a></dt>
<dd><p>Optimize SPIRV using spirv-opt via CLI</p>
<p>Note that the spirv-opt is still experimental.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>spv_bin</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytearray" title="(在 Python v3.10)"><em>bytearray</em></a>) – The spirv file</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>cobj_bin</strong> – The HSA Code Object</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytearray" title="(在 Python v3.10)">bytearray</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.tar">
<span id="tvm-contrib-tar"></span><h2>tvm.contrib.tar<a class="headerlink" href="#module-tvm.contrib.tar" title="永久链接至标题">¶</a></h2>
<p>Util to invoke tarball in the system.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.tar.tar">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.tar.</span></span><span class="sig-name descname"><span class="pre">tar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">files</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.tar.tar" title="永久链接至目标">¶</a></dt>
<dd><p>Create tarball containing all files in root.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target shared library.</p></li>
<li><p><strong>files</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – List of files to be bundled.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.tar.untar">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.tar.</span></span><span class="sig-name descname"><span class="pre">untar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tar_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">directory</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.tar.untar" title="永久链接至目标">¶</a></dt>
<dd><p>Unpack all tar files into the directory</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tar_file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The source tar file.</p></li>
<li><p><strong>directory</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target directory</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.utils">
<span id="tvm-contrib-utils"></span><h2>tvm.contrib.utils<a class="headerlink" href="#module-tvm.contrib.utils" title="永久链接至标题">¶</a></h2>
<p>Common system utilities</p>
<dl class="py exception">
<dt class="sig sig-object py" id="tvm.contrib.utils.DirectoryCreatedPastAtExit">
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">DirectoryCreatedPastAtExit</span></span><a class="headerlink" href="#tvm.contrib.utils.DirectoryCreatedPastAtExit" title="永久链接至目标">¶</a></dt>
<dd><p>Raised when a TempDirectory is created after the atexit hook runs.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.contrib.utils.TempDirectory">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">TempDirectory</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">custom_path</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.TempDirectory" title="永久链接至目标">¶</a></dt>
<dd><p>Helper object to manage temp directory during testing.</p>
<p>Automatically removes the directory when it went out of scope.</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.utils.TempDirectory.set_keep_for_debug">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">set_keep_for_debug</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">set_to</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.TempDirectory.set_keep_for_debug" title="永久链接至目标">¶</a></dt>
<dd><p>Keep temporary directories past program exit for debugging.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.utils.TempDirectory.remove">
<span class="sig-name descname"><span class="pre">remove</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.TempDirectory.remove" title="永久链接至目标">¶</a></dt>
<dd><p>Remove the tmp dir</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.utils.TempDirectory.relpath">
<span class="sig-name descname"><span class="pre">relpath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.TempDirectory.relpath" title="永久链接至目标">¶</a></dt>
<dd><p>Relative path in temp dir</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The name of the file.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>path</strong> – The concatenated path.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.utils.TempDirectory.listdir">
<span class="sig-name descname"><span class="pre">listdir</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.TempDirectory.listdir" title="永久链接至目标">¶</a></dt>
<dd><p>List contents in the dir.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>names</strong> – The content of directory</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)">list</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.utils.tempdir">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">tempdir</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">custom_path</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.tempdir" title="永久链接至目标">¶</a></dt>
<dd><p>Create temp dir which deletes the contents when exit.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>custom_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – Manually specify the exact temp dir path</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>temp</strong> – The temp directory object</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.contrib.utils.TempDirectory" title="tvm.contrib.utils.TempDirectory">TempDirectory</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.contrib.utils.FileLock">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">FileLock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.FileLock" title="永久链接至目标">¶</a></dt>
<dd><p>File lock object</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The path to the lock</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.contrib.utils.FileLock.release">
<span class="sig-name descname"><span class="pre">release</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.FileLock.release" title="永久链接至目标">¶</a></dt>
<dd><p>Release the lock</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.utils.filelock">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">filelock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.filelock" title="永久链接至目标">¶</a></dt>
<dd><p>Create a file lock which locks on path</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The path to the lock</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>lock</strong></p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>File lock object</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.utils.is_source_path">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">is_source_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.is_source_path" title="永久链接至目标">¶</a></dt>
<dd><p>Check if path is source code path.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – A possible path</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>valid</strong> – Whether path is a possible source path</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.utils.which">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.utils.</span></span><span class="sig-name descname"><span class="pre">which</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exec_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.utils.which" title="永久链接至目标">¶</a></dt>
<dd><p>Try to find full path of exec_name</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>exec_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The executable name</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>path</strong> – The full path of executable if found, otherwise returns None</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.contrib.xcode">
<span id="tvm-contrib-xcode"></span><h2>tvm.contrib.xcode<a class="headerlink" href="#module-tvm.contrib.xcode" title="永久链接至标题">¶</a></h2>
<p>Utility to invoke Xcode compiler toolchain</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.xcode.xcrun">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.xcode.</span></span><span class="sig-name descname"><span class="pre">xcrun</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cmd</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.xcode.xcrun" title="永久链接至目标">¶</a></dt>
<dd><p>Run xcrun and return the output.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>cmd</strong> (<em>list of str</em>) – The command sequence.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>out</strong> – The output string.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.xcode.create_dylib">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.xcode.</span></span><span class="sig-name descname"><span class="pre">create_dylib</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objects</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">arch</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sdk</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'macosx'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.xcode.create_dylib" title="永久链接至目标">¶</a></dt>
<dd><p>Create dynamic library.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target shared library.</p></li>
<li><p><strong>objects</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – List of object files.</p></li>
<li><p><strong>options</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The additional options.</p></li>
<li><p><strong>arch</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – Target major architectures</p></li>
<li><p><strong>sdk</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The sdk to be used.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.xcode.compile_metal">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.xcode.</span></span><span class="sig-name descname"><span class="pre">compile_metal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path_target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sdk</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'macosx'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.xcode.compile_metal" title="永久链接至目标">¶</a></dt>
<dd><p>Compile metal with CLI tool from env.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>code</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The cuda code.</p></li>
<li><p><strong>path_target</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – Output file.</p></li>
<li><p><strong>sdk</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The target platform SDK.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>metallib</strong> – The bytearray of the metallib</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytearray" title="(在 Python v3.10)">bytearray</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.contrib.xcode.compile_coreml">
<span class="sig-prename descclassname"><span class="pre">tvm.contrib.xcode.</span></span><span class="sig-name descname"><span class="pre">compile_coreml</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'main'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out_dir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'.'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.contrib.xcode.compile_coreml" title="永久链接至目标">¶</a></dt>
<dd><p>Compile coreml model and return the compiled model path.</p>
</dd></dl>

</div>
</div>


           </div>
           
          </div>
          

<footer>

    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="graph_executor.html" class="btn btn-neutral float-right" title="tvm.contrib.graph_executor" accesskey="n" rel="next">下一个 <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="micro.html" class="btn btn-neutral float-left" title="tvm.micro" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> 上一个</a>
      
    </div>

<div id="button" class="backtop"><img src="../../../_static//img/right.svg" alt="backtop"/> </div>
<section class="footerSec">
    <div class="footerHeader">
      <ul class="d-flex align-md-items-center justify-content-between flex-column flex-md-row">
        <li class="copywrite d-flex align-items-center">
          <h5 id="copy-right-info">© 2020 Apache Software Foundation | All right reserved</h5>
        </li>
      </ul>

    </div>

    <ul>
      <li class="footernote">Copyright © 2020 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.</li>
    </ul>

</section>
</footer>
        </div>
      </div>

    </section>

  </div>
  

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

  </body>
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
    <!-- Theme Analytics -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-75982049-2', 'auto');
    ga('send', 'pageview');
    </script>

    
   

</body>
</html>